package com.tcm.portal.web.controller;


import com.base.core.utils.R;
import com.tcm.content.service.PanelDoctorService;
import com.tcm.content.service.PanelNavService;
import com.tcm.content.service.PanelSlideService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/portal")
@RestController
public class HomeController {

    @DubboReference(version = "0.0.1-alpha", timeout = 6000, check = false, retries = 3)
    private PanelSlideService slideService;

    @DubboReference(version = "0.0.1-alpha", timeout = 6000, check = false, retries = 3)
    private PanelNavService navService;

    @DubboReference(version = "0.0.1-alpha", timeout = 6000, check = false, retries = 3)
    private PanelDoctorService doctorService;

    @GetMapping("/index/slide")
    public R listSlide() {
       return R.success(slideService.listPanelSlideByPanelId(new Long(slideService.getSlidePanelId())));
    }

    /**
     * 获取导航列表
     * @return
     */
    @GetMapping("/index/nav")
    public R listNav() {
        return R.success(navService.listPanelContentByPanelId(new Long(navService.getNavPanelId()), 9));
    }

    /**
     * 获取医生列表
     * @return
     */
    @GetMapping("/index/doctor")
    public R listDoctor() {
        return R.success(doctorService.listPanelContentByPanelId(new Long(doctorService.getDoctorPanelId()), 6));
    }

}

